/*
 * algorithms.h
 *
 *  Created on: 2011-09-10
 *      Author: pawel
 */

#ifndef ALGORITHMS_H_
#define ALGORITHMS_H_
#include<string.h>
namespace bpp{
class BasicSequence;
}
/*
 * direction Matrix is dynamic programming matrix
 * pointer is passed from align algorithm function do align object;
 * passing pointer is faster than copying whole matrix;
 */
struct directionMatrix{
	char **matrix;
	size_t rows;
	size_t cols;
};
/*
 * Cell represents direction matrix cell with highest score
 * backtracking algorithm use this information
 */
struct cell{
	size_t maxRow;
	size_t maxCol;
	int maxscore;
};
class scoreMatrix;
struct bounds{
	int maxDiag;
	int minDiag;
};
struct optAlgParam{
	scoreMatrix *scoreMatrixPtr;//TODO const here?
	 bpp::BasicSequence *querySeqPtr;
	 bpp::BasicSequence *dbSeqPtr;
	 directionMatrix dirMatrix;
	 size_t bestAligns;
	int gopen;
	int gext;
	bounds matrixBounds;
};
class optAlgClass;
class seqFeeder;
class alignContainerV;
struct optAlgThreadParam{
	seqFeeder *seqFeederPtr;
	alignContainerV *alignContainerPtr;
	scoreMatrix *scoreMatrixPtr; //TODO const here?
	bpp::BasicSequence *querySeqPtr;
	optAlgClass *optAlgClassPtr;

	size_t bestAligns;
	int gopen;
	int gext;
	bool btrace;
};
void* optAlgThread(void *arg);
int optAlgThreadRunner(optAlgThreadParam &options, size_t threads);


#endif /* ALGORITHMS_H_ */
